﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using OpenTK;

namespace LasRendering
{
    public static class MatrixHelper
    {
        public static Matrix4 Parse(string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return new Matrix4();
            }

            float[] m = new float[16];
            string[] valueArray = s.Split(new char[] { ' ', ',', ';', '(', ')', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < valueArray.Length; i++)
            {
                m[i] = Convert.ToSingle(valueArray[i]);
            }

            return new Matrix4(
                m[0], m[1], m[2], m[3],
                m[4], m[5], m[6], m[7],
                m[8], m[9], m[10], m[11],
                m[12], m[13], m[14], m[15]);
        }
    }
}
